#ifndef TIMEBAR_H
#define TIMEBAR_H

#include <QWidget>

class TimeBar : public QWidget
{
    Q_OBJECT
public:
    explicit TimeBar(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
    ~TimeBar();

    QPoint getCurDialPos();
signals:
    void signalRepaintDialPos(QPoint pos);

public slots:

protected:
    // Event handlers
    virtual void mousePressEvent(QMouseEvent *event);
    virtual void mouseReleaseEvent(QMouseEvent *);
    virtual void mouseDoubleClickEvent(QMouseEvent *event);
    virtual void mouseMoveEvent(QMouseEvent *event);
#ifndef QT_NO_WHEELEVENT
    virtual void wheelEvent(QWheelEvent *event);
#endif
    virtual void paintEvent(QPaintEvent *event);

    /* 修改wheelValue值 */
    void addWheelValue(int wheelDelta);

    /* 设置当前鼠标点 */
    void setCursorXPos(int xPos);

protected:
    int _curWheelValue; // 鼠标滚动改变开始位置
    double _curDialValue;	// 当前刻度值
    int _minDialValue;  // 刻度最小值
    int _maxDialValue;  // 刻度最大值
    int _dialGap;       // 刻度线间距
    bool _isDragging;    // 是否在拖拽
    QRect _reckText;    // 显示当前时间
    int _textSideGap;   // 显示文字距离边界的距离
};

#endif // TIMEBAR_H
